<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <!-- 页面点击小红心 -->
  <script type="text/javascript" src="/js/clicklove.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/pjax@0.2.8/pjax.js"></script> 

  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.1.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/blog/images/logo.svg" color="#222">

<link rel="stylesheet" href="/blog/css/main.css">


<link rel="stylesheet" href="/blog/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"linzhuangrong.gitee.io","root":"/blog/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="centos7部署redis5-cluster集群">
<meta property="og:type" content="article">
<meta property="og:title" content="centos7部署redis5-cluster集群">
<meta property="og:url" content="https://linzhuangrong.gitee.io/blog/2019/09/15/redis-cluster5/index.html">
<meta property="og:site_name" content="Rong的博客">
<meta property="og:description" content="centos7部署redis5-cluster集群">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://oscimg.oschina.net/oscnet/up-aadfcbce511b194102372e66c2ed4552544.png">
<meta property="og:image" content="https://oscimg.oschina.net/oscnet/up-854f1b640305164d1e14358db7d074eb45e.png">
<meta property="og:image" content="https://oscimg.oschina.net/oscnet/up-ed3c651767deae04cf5edec3c5145f832f9.png">
<meta property="article:published_time" content="2019-09-14T16:00:00.000Z">
<meta property="article:modified_time" content="2020-08-31T15:49:06.849Z">
<meta property="article:author" content="林壮荣">
<meta property="article:tag" content="Redis">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://oscimg.oschina.net/oscnet/up-aadfcbce511b194102372e66c2ed4552544.png">

<link rel="canonical" href="https://linzhuangrong.gitee.io/blog/2019/09/15/redis-cluster5/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>centos7部署redis5-cluster集群 | Rong的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/blog/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">Rong的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/blog/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/blog/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/blog/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://linzhuangrong.gitee.io/blog/2019/09/15/redis-cluster5/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/blog/images/avatar.gif">
      <meta itemprop="name" content="林壮荣">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Rong的博客">
    </span>
      <header class="post-header">
	  
        <h1 class="post-title" itemprop="name headline">
          centos7部署redis5-cluster集群
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2019-09-15 00:00:00" itemprop="dateCreated datePublished" datetime="2019-09-15T00:00:00+08:00">2019-09-15</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-08-31 23:49:06" itemprop="dateModified" datetime="2020-08-31T23:49:06+08:00">2020-08-31</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/%E9%9B%86%E7%BE%A4%E6%9C%8D%E5%8A%A1/" itemprop="url" rel="index"><span itemprop="name">集群服务</span></a>
                </span>
                  ，
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/%E9%9B%86%E7%BE%A4%E6%9C%8D%E5%8A%A1/Redis/" itemprop="url" rel="index"><span itemprop="name">Redis</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
            <div class="post-description">centos7部署redis5-cluster集群</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><strong>centos7部署redis5-cluster集群</strong></p>
<p>Redis的集群方案大致有三种：<br>1）redis cluster集群方案；<br>2）master/slave主从方案；<br>3）哨兵模式来进行主从替换以及故障恢复。(<a target="_blank" rel="noopener" href="https://www.cnblogs.com/dijia478/p/10755580.html">https://www.cnblogs.com/dijia478/p/10755580.html</a>)</p>
<p>但是主从方案和哨兵模式与cluster集群模式相比性能要相对差，所以现在很多企业都换成了集群模式</p>
<p>部署redis5-cluster集群<br>（至少需要3个主节点，生产环境建议用三台机器做，每台上部署一套主从，总共六个节点）</p>
<p>目前测试两个主机部署redis5-cluster集群测试</p>
<p><strong>redis-cluster集群主机清单</strong></p>
<table>
<thead>
<tr>
<th>主机</th>
<th>端口</th>
</tr>
</thead>
<tbody><tr>
<td>192.168.10.128</td>
<td>7001、7002、7003</td>
</tr>
<tr>
<td>192.168.10.129</td>
<td>7004、7005、7006</td>
</tr>
</tbody></table>
<p>1.wget <a target="_blank" rel="noopener" href="http://download.redis.io/releases/redis-5.0.5.tar.gz">http://download.redis.io/releases/redis-5.0.5.tar.gz</a><br>解压，进入解压后的文件夹，执行 make &amp;&amp; make install PREFIX=/usr/local/redis<br>意思是把命令安装到/usr/local/redis/下面</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#!/bin/bash</span></span><br><span class="line">REDISVERSION=<span class="string">&quot;redis-5.0.8&quot;</span></span><br><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span></span><br><span class="line">wget http://download.redis.io/releases/<span class="variable">$&#123;REDISVERSION&#125;</span>.tar.gz</span><br><span class="line">tar xf <span class="variable">$&#123;REDISVERSION&#125;</span>.tar.gz</span><br><span class="line"><span class="built_in">cd</span> <span class="variable">$REDISVERSION</span></span><br><span class="line">make &amp;&amp; make install PREFIX=/usr/<span class="built_in">local</span>/redis</span><br><span class="line"><span class="built_in">echo</span> <span class="string">&quot;PATH=<span class="variable">$PATH</span>:/usr/local/redis/bin&quot;</span> &gt; /etc/profile.d/redis.sh</span><br><span class="line"><span class="built_in">source</span>   /etc/profile.d/redis.sh</span><br></pre></td></tr></table></figure>

<p>2.进入文件夹 cd /usr/local/redis/<br>创建集群文件夹redis-cluster，把节点配置文件放到里面管理 mkdir redis-cluster<br>进入文件夹 cd redis-cluster</p>
<p>节点一  192.168.10.128</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /usr/<span class="built_in">local</span>/redis/</span><br><span class="line">mkdir redis-cluster</span><br><span class="line"><span class="built_in">cd</span> redis-cluster</span><br><span class="line">mkdir 7001 7002 7003</span><br><span class="line">mkdir data</span><br></pre></td></tr></table></figure>

<p>节点二  192.168.10.129</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">cd &#x2F;usr&#x2F;local&#x2F;redis&#x2F;</span><br><span class="line">mkdir redis-cluster</span><br><span class="line">cd redis-cluster</span><br><span class="line">mkdir 7004 7005 7006</span><br><span class="line">mkdir data</span><br></pre></td></tr></table></figure>

<p>3.部署六个节点，因为是实验机器所以都部署在一台机器上，生产环境应该部署在多台机器上，多台机器都安装redis,每一台上都创建一个目录夹，比如是三台机器就一台上创建两个目录夹，总共六个，命令复制到其他机器上。</p>
<p>4.新建配置文件</p>
<p>vim 7001/redis.conf （内存分配设置maxmemory ）</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">bind</span> 0.0.0.0 </span><br><span class="line">protected-mode yes</span><br><span class="line">port 7001</span><br><span class="line">tcp-backlog 511</span><br><span class="line">tcp-keepalive 300</span><br><span class="line">daemonize yes </span><br><span class="line">supervised no</span><br><span class="line">pidfile /usr/<span class="built_in">local</span>/redis/redis-cluster/7001/redis.pid</span><br><span class="line">dir /usr/<span class="built_in">local</span>/redis/redis-cluster/data </span><br><span class="line">loglevel notice</span><br><span class="line">logfile <span class="string">&quot;/usr/local/redis/redis-cluster/7001/stdout.log&quot;</span></span><br><span class="line">databases 16</span><br><span class="line">maxclients 10000                    </span><br><span class="line">maxmemory  8192MB  </span><br><span class="line">appendonly no</span><br><span class="line">cluster-enabled yes</span><br><span class="line">cluster-config-file 7001-nodes.conf</span><br><span class="line">cluster-node-timeout 15000</span><br><span class="line">slowlog-log-slower-than 10000</span><br></pre></td></tr></table></figure>

<p>其他7002/redis.conf 7003/redis.conf也是一样，记得改端口和文件名</p>
<p><strong>启动节点</strong><br>节点一</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;usr&#x2F;local&#x2F;redis&#x2F;bin&#x2F;redis-server  &#x2F;usr&#x2F;local&#x2F;redis&#x2F;redis-cluster&#x2F;7001&#x2F;redis.conf </span><br><span class="line">&#x2F;usr&#x2F;local&#x2F;redis&#x2F;bin&#x2F;redis-server  &#x2F;usr&#x2F;local&#x2F;redis&#x2F;redis-cluster&#x2F;7002&#x2F;redis.conf </span><br><span class="line">&#x2F;usr&#x2F;local&#x2F;redis&#x2F;bin&#x2F;redis-server  &#x2F;usr&#x2F;local&#x2F;redis&#x2F;redis-cluster&#x2F;7003&#x2F;redis.conf </span><br></pre></td></tr></table></figure>

<p>节点二</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;usr&#x2F;local&#x2F;redis&#x2F;bin&#x2F;redis-server  &#x2F;usr&#x2F;local&#x2F;redis&#x2F;redis-cluster&#x2F;7004&#x2F;redis.conf</span><br><span class="line">&#x2F;usr&#x2F;local&#x2F;redis&#x2F;bin&#x2F;redis-server  &#x2F;usr&#x2F;local&#x2F;redis&#x2F;redis-cluster&#x2F;7005&#x2F;redis.conf</span><br><span class="line">&#x2F;usr&#x2F;local&#x2F;redis&#x2F;bin&#x2F;redis-server  &#x2F;usr&#x2F;local&#x2F;redis&#x2F;redis-cluster&#x2F;7006&#x2F;redis.conf</span><br></pre></td></tr></table></figure>

<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">#关闭应用节点</span><br><span class="line"></span><br><span class="line">redis-cli  -h 192.168.10.128 -p 7001 shutdown</span><br><span class="line">redis-cli  -h 192.168.10.128 -p 7002 shutdown</span><br><span class="line">redis-cli  -h 192.168.10.128 -p 7003 shutdown</span><br><span class="line">redis-cli  -h 192.168.10.129 -p 7004  shutdown</span><br><span class="line">redis-cli  -h 192.168.10.129 -p 7005  shutdown</span><br><span class="line">redis-cli  -h 192.168.10.129 -p 7006  shutdown</span><br></pre></td></tr></table></figure>

<p><strong>两种启用集群方式：</strong><br>一，自动创建并启动集群</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">redis-cli --cluster create 192.168.10.128:7001 192.168.10.128:7002 192.168.10.128:7003 192.168.10.129:7004 192.168.10.129:7005 192.168.10.129:7006 --cluster-replicas 1 -a epaylinks</span><br></pre></td></tr></table></figure>

<blockquote>
<p>输入yes</p>
<p>netstat -nalp | grep redis | grep LISTEN</p>
<p>查看六个节点的端口是否正常</p>
</blockquote>
<p><strong><a target="_blank" rel="noopener" href="https://www.cnblogs.com/dijia478/p/10755580.html">二</a>，手工创建集群，配置主从节点</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">redis-cli --cluster create 192.168.10.128:7001 192.168.10.128:7002 192.168.10.128:7003 --cluster-replicas 0 -a epaylinks</span><br></pre></td></tr></table></figure>

<p><img src="https://oscimg.oschina.net/oscnet/up-aadfcbce511b194102372e66c2ed4552544.png"></p>
<p>手动添加slaver<br>使用创建时的cluster-master-id 或执行 redis-cli –cluster check 192.168.10.128:7001 -a epaylinks查看运行状态</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[root@fastdfs-1-1 redis-cluster]<span class="comment"># redis-cli --cluster check 192.168.10.128:7001 -a epaylinks </span></span><br><span class="line">Warning: Using a password with <span class="string">&#x27;-a&#x27;</span> or <span class="string">&#x27;-u&#x27;</span> option on the <span class="built_in">command</span> line interface may not be safe. 192.168.10.128:7001 (d1f1a7d6...) -&gt; 0 keys | 5461 slots | 0 slaves. 192.168.10.128:7002 (540f07e0...) -&gt; 0 keys | 5462 slots | 0 slaves. 192.168.10.128:7003 (2c76c712...) -&gt; 0 keys | 5461 slots | 0 slaves. [OK] 0 keys <span class="keyword">in</span> 3 masters. 0.00 keys per slot on average.</span><br><span class="line"></span><br><span class="line">&gt; Performing Cluster Check (using node 192.168.10.128:7001) M: d1f1a7d6f76b9909ff61c6d6a80d5ebe28075758 192.168.10.128:7001 slots:[0-5460] (5461 slots) master M: 540f07e0283aa009043aaa264caba5d32603a096 192.168.10.128:7002 slots:[5461-10922] (5462 slots) master M: 2c76c712f9438c6354468d9060f43548d5b429de 192.168.10.128:7003 slots:[10923-16383] (5461 slots) master [OK] All nodes agree about slots configuration.</span><br><span class="line"></span><br><span class="line">&gt; Check <span class="keyword">for</span> open slots... &gt; Check slots coverage... [OK] All 16384 slots covered.</span><br></pre></td></tr></table></figure>

<p><strong>挂载slave</strong></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">redis-cli --cluster add-node 192.168.10.129:7004 192.168.10.128:7001 --cluster-slave --cluster-master-id d1f1a7d6f76b9909ff61c6d6a80d5ebe28075758 -a epaylinks </span><br><span class="line"></span><br><span class="line">redis-cli --cluster add-node 192.168.10.129:7005 192.168.10.128:7001 --cluster-slave --cluster-master-id 540f07e0283aa009043aaa264caba5d32603a096 -a epaylinks </span><br><span class="line"></span><br><span class="line">redis-cli --cluster add-node 192.168.10.129:7006 192.168.10.128:7001 --cluster-slave --cluster-master-id 2c76c712f9438c6354468d9060f43548d5b429de -a epaylinks</span><br></pre></td></tr></table></figure>

<p><img src="https://oscimg.oschina.net/oscnet/up-854f1b640305164d1e14358db7d074eb45e.png"></p>
<blockquote>
<p>测试</p>
<p>redis-cli -c -h 192.168.10.128 -p 7001</p>
</blockquote>
<blockquote>
<p>查看集群节点状态 CLUSTER NODES</p>
</blockquote>
<p><img src="https://oscimg.oschina.net/oscnet/up-ed3c651767deae04cf5edec3c5145f832f9.png"></p>
<h1 id="备注"><a href="#备注" class="headerlink" title="备注"></a>备注</h1><p><strong>单机</strong>集群快速部署管理</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd &#x2F;usr&#x2F;local&#x2F;redis-5.0.8&#x2F;utils&#x2F;create-cluster​​​​​​​</span><br><span class="line">vi create-cluster</span><br></pre></td></tr></table></figure>

<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="section"># Settings</span></span><br><span class="line">PORT=7000</span><br><span class="line">TIMEOUT=2000</span><br><span class="line">NODES=6</span><br><span class="line">REPLICAS=1</span><br></pre></td></tr></table></figure>

<p>把其中的PORT修改为7000, NODES为6（节点），即上面设置的最小的端口7000加1， 7001,7002/7003/7004/7005/7006</p>
<p>关闭集群</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">.&#x2F;create-cluster stop</span><br></pre></td></tr></table></figure>

<p>启动集群</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">.&#x2F;create-cluster start</span><br></pre></td></tr></table></figure>
    </div>

    
    
    
 
    <div>
      
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span><a href="/blog/2019/09/15/redis-cluster5/">centos7部署redis5-cluster集群</a></p>
  <p><span>文章作者:</span><a href="/" title="访问  的个人博客"></a></p>
  <p><span>发布时间:</span>2019年09月15日 - 00:09</p>
  <p><span>最后更新:</span>2020年08月31日 - 23:08</p>
  <p><span>原始链接:</span><a href="/blog/2019/09/15/redis-cluster5/" title="centos7部署redis5-cluster集群">https://linzhuangrong.gitee.io/blog/2019/09/15/redis-cluster5/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://linzhuangrong.gitee.io/blog/2019/09/15/redis-cluster5/"  aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
    $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
    });
    });  
</script>


      
    </div>

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/blog/tags/Redis/" rel="tag"># Redis</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/blog/2019/08/15/Linux%E7%B3%BB%E7%BB%9F%E4%B8%AD%E7%9A%84load%20average/" rel="prev" title="Linux系统中的load average">
      <i class="fa fa-chevron-left"></i> Linux系统中的load average
    </a></div>
      <div class="post-nav-item">
    <a href="/blog/2019/09/15/redis-cluster5%20-%203/" rel="next" title="Redis Cluster在线迁移">
      Redis Cluster在线迁移 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%A4%87%E6%B3%A8"><span class="nav-number">1.</span> <span class="nav-text">备注</span></a></li></ol></div>
      </div>
      <!--/noindex-->
    
           <div>
            <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=144301&auto=1&height=66"></iframe>
           </div>
   
      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">林壮荣</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">20</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/blog/categories/">
          
        <span class="site-state-item-count">7</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/blog/tags/">
        <span class="site-state-item-count">3</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">林壮荣</span>
</div>
<div class="theme-info">
  <div class="powered-by"></div>
  <span class="post-count">博客全站共31.2k字</span>
</div>

<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

<div class="powered-by">
  <i class="fa fa-user-md"></i>
  <span id="busuanzi_container_site_pv">
    本站访问量:<span id="busuanzi_value_site_pv"></span>次
  </span>
  <span class="post-meta-divider">|</span>
  <span id="busuanzi_container_site_uv">
    本站总访客量：<span id="busuanzi_value_site_uv"></span>人
  </span>
</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/blog/lib/anime.min.js"></script>
  <script src="/blog/lib/velocity/velocity.min.js"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js"></script>

<script src="/blog/js/utils.js"></script>

<script src="/blog/js/motion.js"></script>


<script src="/blog/js/schemes/pisces.js"></script>


<script src="/blog/js/next-boot.js"></script>




  




  
<script src="/blog/js/local-search.js"></script>













  

  

</body>
</html>
